<meta title="基础配置" args="data"/>
<style>

</style>
<form class="form-horizontal" id="form" s="form,datac,nda,valid" s-data="data" style="width: 600px;">
    <div class="form-group">
        <label class="col-sm-3 control-label">用户默认昵称</label>
        <div class="col-sm-9">
            <input autocomplete="off" type="text" class="form-control" name="defaultUserNickname" placeholder="用户默认昵称"
                   s-valid-error="require()"/>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label">用户默认头像</label>
        <div class="col-sm-9">
            <input autocomplete="off" type="text" class="form-control" id="defaultUserAvatarUrl" name="defaultUserAvatarUrl" placeholder="用户默认头像"
                   s-click="selectUserAvatar()"
                   s-valid-error="require()"/>
        </div>
    </div>
</form>
<script type="text/javascript">
    S.getContent = function () {
        var deferred = $.Deferred();
        $form.validate().done(function() {
            deferred.resolve(Smart.serializeToObject($form.node))
        })
        return deferred;
    }

    function selectUserAvatar() {
        S.popupOpen("/oss/objects-selector.html", {prefix: 'icon'}).done(function(datas) {
            if(datas) {
                var icon = datas[0];
                $defaultUserAvatarUrl.node.val(icon.url)
            }
        })
    }
</script>